<%@ page import="java.util.List" %>
<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: dailyblue
  Date: 2024/1/22
  Time: 11:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>循环操作（重点）</title>
</head>
<body>
<h3>for循环</h3>
<%--
step:必须大于0
  for(int i=1;i<=10;i++){
  }

--%>
<c:forEach var="i" begin="1" end="10" step="1">
    ${i} &nbsp;
</c:forEach>
<br/>
<c:forEach var="i" begin="0" end="9" step="1">
    ${10-i} &nbsp;
</c:forEach>
<hr/>
<h3>foreach</h3>
<%
    List<String> list = Arrays.asList("aa","bb","cc","dd","ee");
    session.setAttribute("LIST",list);
%>
<%--
int i = 0;
    for(String s:list){
    i++;
    }
--%>
<c:forEach var="s" items="${LIST}" varStatus="j">
    ${j.count}..${j.index}..${s}<br/>
</c:forEach>
</body>
</html>